package com.sanjiahantang.youjiaclient.module.evaluate.beans;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.sanjiahantang.youjiaclient.base.BaseBean;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zy on 2017/11/28.
 */

public class RoleBean extends BaseBean {

    public List<Data> getData() {
        return new Gson().fromJson(data,new TypeToken<List<Data>>(){}.getType());
    }

    public void setData(String data) {
        this.data = data;
    }

    private String data;



    public static class Data{

        private int msId;
        private String roleName;
        private String rolePhone;
        private int roleTypeId;
        private String roleTypeName;
        private String url;
        private int userRequireId;
        private float money;

        public float getMoney() {
            return money;
        }

        public void setMoney(float money) {
            this.money = money;
        }

        public int getUserRequireId() {
            return userRequireId;
        }

        public void setUserRequireId(int userRequireId) {
            this.userRequireId = userRequireId;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public static Data objectFromData(String str) {

            return new Gson().fromJson(str, Data.class);
        }

        public static Data objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), Data.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<Data> arrayDataFromData(String str) {

            Type listType = new TypeToken<ArrayList<Data>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<Data> arrayDataFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<Data>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public int getMsId() {
            return msId;
        }

        public void setMsId(int msId) {
            this.msId = msId;
        }

        public String getRoleName() {
            return roleName;
        }

        public void setRoleName(String roleName) {
            this.roleName = roleName;
        }

        public String getRolePhone() {
            return rolePhone;
        }

        public void setRolePhone(String rolePhone) {
            this.rolePhone = rolePhone;
        }

        public int getRoleTypeId() {
            return roleTypeId;
        }

        public void setRoleTypeId(int roleTypeId) {
            this.roleTypeId = roleTypeId;
        }

        public String getRoleTypeName() {
            return roleTypeName;
        }

        public void setRoleTypeName(String roleTypeName) {
            this.roleTypeName = roleTypeName;
        }
    }
}
